import {
    fetchPartitions,
    remove,
    add,
    edit
  } from "@/api/partition"
  export default {
    namespaced: true, // 封闭
    state: {},
    mutations: {},
    getters: {},
    actions: {
      async fetchPartitions(context) {
        try {
          return await fetchPartitions()
        } catch (err) {
          console.log(err)
        }
      },

      async remove(context, id){
        try {
          return await remove(id)
        } catch (err) {
          console.log(err)
        }
      },

      async add(context, data) {
        try{
          let { name } = data
          return await add(name)
        } catch(err){
          console.log('err', err)
        }
      },

      async edit(context, data) {
        try{
          let { id, name } = data
          return await edit(id, name)
        } catch(err){
          console.log('err', err)
        }
      }
    }
  }
  